package com.vcredit.creditcat.web.app;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.vcredit.creditcat.api.ICreditEntityManager;
import com.vcredit.creditcat.dto.creditentity.CreditEntityDto;
import com.vcredit.creditcat.vo.CreditTipsResponseVo;
import com.vcredit.creditcat.vo.CreditTipsVo;
import com.vcredit.creditcat.vo.JsonResult;
import com.vcredit.framework.annotation.Log;

/**
 * 信用帖查询
 * 
 * @author zhangboshi
 *
 */
@RestController
@RequestMapping("/creditTips")
public class CreditEntityQueryController extends BaseCreditCatController {

	@Reference(version = "1.0")
	private ICreditEntityManager creditEntityManager;

	/**
	 * 获取信用贴士列表
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@Log
	@RequestMapping(value = "/query")
	public JsonResult<CreditTipsVo> creditTipsQuert(@RequestBody @Valid CreditTipsResponseVo param, HttpServletRequest request)
			throws Exception {
		List<CreditEntityDto> responseList= creditEntityManager.creditEntityQuery(param.getPageIndex(),param.getShowPosition());
		return JsonResult.SuccessResponse(new CreditTipsVo(responseList));
	}
}
